<template>
	<!-- 04机构管理员注册-待审核 -->
	<view>
		<!-- 自定义导航栏 -->
		<view class="navBarBox">
			<!-- 状态栏占位 -->
			<view class="statusBar" :style="{ paddingTop: statusBarHeight + 'px' }"></view>
			<!-- 真正的导航栏内容 -->
			<view class="navBar">
				<view class="goback">
					<view @click="goBack" class="goicon" style="background:url('../../../static/goback.png');background-size:contain;background-repeat: no-repeat;">			
					</view>
				</view>
				<view class="titlen">机构管理员注册</view>
				<view class="right"> 
				</view>
			</view>
		</view>
		<view class="black-strip"></view>
		<!-- 基本信息 -->
		<view class="jibenxinxi common1">		
			<view class="common2">
				<view class="common2-tit">
					<text>基本信息</text>
				</view>
			</view>
			<view class="main">
				<view class="jiben1">
					<text class="title">机构名称</text>
					<input type="text" value="" @input='inputOrganizationName' class="title1" :value="regAdd.organizationName" placeholder="机构名称"/>
				</view>
				<view class="jiben1">
					<text class="title">机构所在地</text>
					<picker mode="region" @change="addRessChoose">
						<input type="text" class="title1" placeholder="选择地区" :value="addRess"/>
					</picker>
				</view>
				<view class="jiben1 xiangqing">
					<input type="text" value="" class="title1" placeholder="请输入机构详细地址"/>
				</view>
				<view class="jiben1">
					<text class="title">机构简介</text>
					<textarea value="" @input='inputIntro' class="title1 txtarea" :value="regAdd.intro" />
				</view>
				<view class="jiben1">
					<text class="title">联系人</text>
					<input type="text" @input='inputLinkman' :value="regAdd.linkman"  class="title1" />
				</view>
				<view class="jiben1">
					<view class="title phone">
						<text>联系电话</text>
					</view>
					<input type="phone" @input='inputPhone' :value="regAdd.phone" class="title1"/>
				</view>
				<view class="jiben1">
					<text class="title">老师规模<text class="title1">(人)</text></text>
					<input type="text"  @input='inputTeacherScale' :value="regAdd.teacherScale" class="title1" />
				</view>
				<view class="jiben1">
					<text class="title">场地面积<text class="title1">(m²)</text></text>
					<input type="text"  @input='inputFloorSpace' :value="regAdd.floorSpace" class="title1" />
				</view>
			</view>
		</view>
		<view class="black-strip"></view>
		<!-- 营业执照 -->
		<view class="common4 common1">
			<view class="common2">
				<view class="common2-tit">
					<text>营业执照</text>
				</view>
			</view>
			<view class="main1">
				<view class="jiben1">
					<text class="title">执照名称</text>
					<input type="text"  @input='inputLicenseName'  :value="regAdd.licenseName" class="title1"/>
				</view>
				<view class="jiben1">
					<text class="title">执照号码</text>
					<input type="number"  @input='inputLicenseNumber' :value="regAdd.licenseNumber" value="" class="title1"/>
				</view>
				<view class="common3">
					<view class="title">上传凭证</view>
					<image v-if='show' :src="regAdd.license"  class="img4"  mode=""></image>
					<view v-if="hide" class="page" @click="imgPicture()">
					    <text>＋</text>
					</view>
				</view>
			</view>
		</view>
		<view class="black-strip"></view>
		<!-- 办学许可 -->
		<view class="common4 common1">
			<view class="common2">
				<view class="common2-tit">
					<text>办学许可</text>
				</view>
			</view>
			<view class="main1">
				<view class="jiben1">
					<text class="title">执照名称</text>
					<input type="text" @input='inputLicenseName'  :value="regAdd.licenseName" class="title1"/>
				</view>
				<view class="jiben1">
					<text class="title">所在地址</text>
					<input type="text" @input='inputDetailedAddress' :value="regAdd.detailedAddress" class="title1"/>
				</view>
				<view class="common3">
					<text class="title">办学许可证</text>
			
					<view   class="page" @click="imgPicture()">
					    <text>＋</text>
					</view>
				</view>
			</view>
		</view>
		<view class="black-strip"></view>
		<!-- 社会团体法人登记 -->
		<view class="common4 common1">
			<view class="common2">
				<view class="common2-tit">
					<text>社会团体法人登记</text>
				</view>
			</view>
			<view class="main1">
				<view class="jiben1">
					<text class="title">法人姓名</text>
					<input type="text" @input='inputPersonRegistration' :value="regAdd.personRegistration" class="title1"/>
				</view>
				<view class="jiben1">
					<text class="title">法人身份证号</text>
					<input type="number" value="" class="title1" maxlength="18"/>
				</view>
				<view class="common3">
					<text class="title">上传凭证</text>
				
					<view class="page" @click="imgPicture()">
					    <text>＋</text>
					</view>
				</view>
			</view>
		</view>
		<view class="black-strip"></view>
		<!-- 历史成果案例 -->
		<view class="chengguo common1">
			<view class="common2">
				<view class="common2-tit">
					<text>历史成果</text>
				</view>
			</view>
			<textarea :value="regAdd.historical" @input='textHistorical' class="title1"/>
		</view>
		<!-- 提交按钮 -->
		<view class="submit">
			<button type="default" hover-class="button-hover" @click="goRegVerify">提交审核</button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				show:false,
				hide:true,
				addRess:'',//机构所属地区
				// 状态栏高度
				statusBarHeight: 0,
				// 导航栏高度
				navBarHeight: 82+11,
				regAdd:{
					province:'',//省
					city:'',//市
					county:'',//县
					detailedAddress:'',//机构所在地址
					intro: '',//机构简介
					floorSpace: '',//场地面积
					historical:'',//历史成果
					id:'0',
					license: '',//凭证
					licenseName:'',//执照名称
					licenseNumber:'',//执照号码
					linkman:'',//联系人
					orgType: 1,//组织类型
					organizationName:'',//机构名称
					personRegistration:'',//社会团队法人登记
					phone:'',//联系电话
					qualificationCertification: '',//采购资质认证
					schoolPermission: '',//办学许可
					teacherScale: '',//老师规模
				},
			}
		},
		methods: {
			imgPicture(){
				uni.chooseImage({
					count: 6, //默认9
					sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图，默认二者都有
					sourceType: ['album'], //从相册选择
					success:(res)=>  {
						this.show=true;
						this.hide=false;
						this.regAdd.license=res.tempFilePaths
						
					}
				});
			},
			
			//获取机构名称
			inputOrganizationName(e){	
				this.regAdd.organizationName=e.detail.value
			},
			//选择地址返机构
			addRessChoose:function(e) {
				var arr = e.target.value;
				this.addRess=arr;
				this.regAdd.province=arr[0];
				this.regAdd.city=arr[1];
				this.regAdd.county=arr[2];
			},
			//获取机构简介
			inputIntro(e){
				this.regAdd.intro=e.detail.value
			},
			//获取联系人
			inputLinkman(e){
				this.regAdd.linkman=e.detail.value
			},
			//获取联系电话
			inputPhone(e){
				this.regAdd.phone=e.detail.value
			},
			//获取老师规模
			inputTeacherScale(e){
				this.regAdd.teacherScale=e.detail.value
			},
			//获取场地面积
			inputFloorSpace(e){
				this.regAdd.floorSpace=e.detail.value
			},
			//获取执照名称
			inputLicenseName(e){
				this.regAdd.licenseName=e.detail.value
			},
			//获取执照号码
			inputLicenseNumber(e){
				this.regAdd.licenseNumber=e.detail.value
			},
			//获取机构所在地址
			inputDetailedAddress(e){
				this.regAdd.detailedAddress=e.detail.value
			},
			//获取法人
			inputPersonRegistration(e){
				this.regAdd.personRegistration=e.detail.value
			},
			//获取历史成果
			textHistorical(e){
				this.regAdd.historical=e.detail.value
			},
			// 提交审核-进入资料审核页
			goRegVerify(){
				this.$myRequest({
					url: '/Organization/add',
					method:'post',
					data:{
						teacher:this.regAdd
					},
					success: (res) => {
						console.log(res.data,'数据')
						// this.id=res.data.data.id
						// console.log(this.regAdd)
						uni.setStorageSync('mechManagRegisterData', this.regAdd);
						uni.navigateTo({
							url:'./mechManagRegVerify?'+this.id
						})
					},
					fail: (err) => {
						console.log(err)
						console.log('获取数据中')
				
					}
				})
				
			},
			
			
			// 返回上一页
			goBack(){
				// 此处是写返回页面的方法、
							
				uni.navigateBack({
					delta: 1//返回只上一级页面
				});
			},
	
		},
		//第一次加载时调用
		created() {
			//获取手机状态栏高度
			this.statusBarHeight = uni.getSystemInfoSync()['statusBarHeight'];
		},
	}
</script>

<style lang="less">
	
	.navBarBox .navBar {
			padding: 3rpx 50rpx;
			padding-bottom: 8rpx;
			display: flex;
			justify-content: space-between;
			line-height: 93rpx;
			font-size: 40rpx;
		}
	
		.goback {
			flex: 1;
			height: 100%;
		}
		.goicon{
			width: 30rpx;
			height: 30rpx;
			background-color: #00BEA9;
			margin-top: 30rpx;
		}
		.titlen {
			font-size: 40rpx;
			flex: 2;
			height: 100%;
			
		}
		.right{
			flex: 1;
		}
	 .black-strip {
	 	height: 20rpx;
	 	background-color: #fafafa;
	 }
	.common1 {
		background-color: #fff;
		padding-left: 28rpx;
		// margin-top: 20rpx;
	}
	.jibenxinxi {
		height: 1144rpx;
	}
	.common2 {
		height: 126rpx;
		display: flex;
		align-items: center;
	}
	.common2-tit {
		// width: 158rpx;
		height: 24rpx;
		background-color: #a2f8ee;
		display: flex;
		justify-content: center;
		align-items: center;
		text {
			font-size:38rpx;
		}
	}
		
	.main {
		height: 976rpx;
		display: flex;
		flex-direction: column;
		justify-content: space-between;
	}
	.jiben1 {
		height: 104rpx;
		border-bottom: 2rpx solid #eee;
		.txtarea {
			width: 100%;
			height: 50rpx;
			overflow: auto;
		}
		.phone {
			display: flex;
			justify-content: flex-start;
			input {
				margin-left: 20rpx;
			}
		}
	}
	.title {
		font-size: 32rpx;
	}
	.title1 {
		font-size: 28rpx;
		color: #7d7d7d;
	}
	.common4 {
		height: 678rpx;
		.main1 {
			height: 552rpx;
			display: flex;
			flex-direction: column;
			justify-content: space-between;
		}
	}
	.common3 {
		height: 304rpx;
		.img4{
			margin-left:200rpx ;
			width: 200rpx;
			height: 200rpx; 
			margin-bottom: 46rpx;
		}
	}
	.chengguo {
		height: 332rpx;
		padding-right: 28rpx;
		textarea {
			width: 100%;
			height: 174rpx;
			border: 2rpx solid #eee;
		}
	}
	.xiangqing {
		display: flex;
		align-items: center;
	}
	.page {
		margin-top: 40rpx;
		margin-left: 128rpx;
		width: 185rpx;
		height: 185rpx;
		border: 2rpx dashed #bfbfbf;
		text-align: center;
		text {
			line-height: 185rpx;
			font-size: 24rpx;
		}
	}
	.submit {
		height: 156rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		button {
			width: 228rpx;
			height: 70rpx;
			background-color: #2db3fe;
			color: #fff;
			font-size: 28rpx;
			border: none;
			box-shadow: 0 0 20rpx 3rpx rgba(180,226,251);
			
		}
	}
	.button-hover[type="default"] {
		color: #fff;
		background-color: #118ace;
	}
</style>
